package com.wingsfrog.travel.modules.dao;

import com.wingsfrog.travel.modules.entity.User;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Created by rankin on 16/3/30.
 */
public interface UserDao extends CrudRepository<User, Integer> {
    @Query("select u from User u,UserTeamRel ut,TeamInfo ti where u.id = ut.userId and ut.teamId = ti.id and ti.mainTaskId = ?1")
    public List<User> getUserByMainTaskIdEquals(Integer mainTaskId);
    @Query("select u from User u,UserTeamRel ut where ut.teamId = ?1 and u.id = ut.userId")
    public List<User> getUserByTeamId(Integer teamId);
    public User getByToken(String token);
    public User getByPhone(String phone);
}
